<?php
/**
 * Joomla! 1.5 component JoomGPSTracks
 *
 * @version $Id: view.html.php 2009-06-24 15:40:19 svn $
 * @author Michael Pfister
 * @package joomGPStracks
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

// Import Joomla! libraries
jimport( 'joomla.application.component.view');

/**
 *
 */
class JoomgpstracksViewConfig extends JView {
    /**
     *
     * @param object $tpl
     */
    function display($tpl = null) {

        jimport('joomla.filesystem.file');
        $config =& JoomgpstracksHelper::getConfig();
        $captcha = checkCaptcha();
        $cactiv = ($captcha > 0) ? '<font color="green">'.JText::_("GPS_INSTALLED").'</font>' : '<font color="red">'.JText::_("GPS_NOT_INSTALLED").'</font>';
        $model = $this->getModel();
        $row = $model->getContent();
        $tmpl = $model->getTemplates();
        // unit array for lists
        $unit = array();
        array_push($unit, array("unit"  =>  "Kilometer"));
        array_push($unit, array("unit"  =>  "Miles"));
        // users array for lists
        $users = array(
            array('id' => 0, 'text' => JText::_('GPS_PUPLIC')),
            array('id' => 1, 'text' => JText::_('GPS_REGISTERED'))
        );
        // yes/no array for lists
        $inform = array(
            array('id' => 0, 'text' => JText::_('no')),
            array('id' => 1, 'text' => JText::_('yes'))
        );
        // comments order aray for lists
        $order =array(
            array('order' => 'DESC', 'text' => JText::_('GPS_NEWEST')),
            array('order' => 'ASC', 'text' => JText::_('GPS_OLDEST'))
        );
        $comments = array(
            array('id' => 0, 'text' => JText::_('GPS_NO_COMMENTS')),
            array('id' => 1, 'text' => JText::_('GPS_INTERN_COMMENTS')),
            array('id' => 2, 'text' => JText::_('GPS_JOMCOMMENTS'))
        );

        // build the html select list
        $acl =& JFactory::getACL();
        $gtree = $acl->get_group_children_tree( null, 'USERS', false );
	$lists['gid']       = JHTML::_('select.genericlist',   $gtree, 'gid', 'size="10"', 'value', 'text', $config->gid );
        $lists['content']   = JHTML::_('select.genericlist',   $row, 'terms_id', 'size="5"', 'id', 'title', $config->terms_id );
        $lists['unit']      = JHTML::_('select.genericlist', $unit, 'unit', 'size="1"', 'unit', 'unit', $config->unit );
        $lists['tmpl']      = JHTML::_('select.genericlist', $tmpl, 'template', 'size="1"', 'name', 'name', $config->template );
        $lists['who']       = JHTML::_('select.genericlist', $users, 'comment_who', 'size="2"', 'id', 'text', $config->comment_who );
        $lists['inform']    = JHTML::_('select.genericlist', $inform, 'inform_autor', 'size="2"', 'id', 'text', $config->inform_autor );
        $lists['captcha']   = JHTML::_('select.genericlist', $inform, 'captcha', 'size="2"', 'id', 'text', $config->captcha );
        $lists['order']     = JHTML::_('select.genericlist', $order, 'ordering', 'size="2"', 'order', 'text', $config->ordering );
        $lists['comments']  = JHTML::_('select.genericlist', $comments, 'comments', 'size="3"', 'id', 'text', $config->comments );
        $lists['access']   = JHTML::_('select.genericlist', $inform, 'access', 'size="2"', 'id', 'text', $config->access );


        $this->assignRef('config',  $config);
        $this->assignRef('lists',   $lists);
        $this->assignRef('captcha', $cactiv);
        
        parent::display($tpl);
    }
}
?>